Menu Top
Complete Course of Mathematics
Topic 1: Numbers & Numerical Applications Topic 2: Algebra Topic 3: Quantitative Aptitude
Topic 4: Geometry Topic 5: Construction Topic 6: Coordinate Geometry
Topic 7: Mensuration Topic 8: Trigonometry Topic 9: Sets, Relations & Functions
Topic 10: Calculus Topic 11: Mathematical Reasoning Topic 12: Vectors & Three-Dimensional Geometry
Topic 13: Linear Programming Topic 14: Index Numbers & Time-Based Data Topic 15: Financial Mathematics
Topic 16: Statistics & Probability


Content On This Page
Derivation of the Distance Formula Calculating Distance Between Two Points Applications of Distance Formula (e.g., verifying geometric properties, collinearity)


Distance Formula in Two Dimensions



Derivation of the Distance Formula

The distance formula is a fundamental tool in coordinate geometry used to calculate the length of the straight line segment connecting two points in a Cartesian plane. Its derivation relies directly on the application of the Pythagorean theorem.

Let's consider two distinct points in the two-dimensional Cartesian plane:

Our objective is to find the distance, denoted by $d$, between these two points P and Q. This distance is represented by the length of the line segment $\overline{PQ}$.

Derivation using Pythagorean Theorem

To use the Pythagorean theorem, we need to construct a right-angled triangle involving the points P and Q. We can do this by drawing lines parallel to the coordinate axes.

Construction:

  1. Draw a line through point P that is parallel to the x-axis.
  2. Draw a line through point Q that is parallel to the y-axis.
  3. Let these two constructed lines intersect at a point, which we will call R.

Now, let's determine the coordinates of this intersection point R. Since the line segment PR is parallel to the x-axis, any point on this line has the same y-coordinate as P. Thus, the y-coordinate of R is $y_1$. Since the line segment QR is parallel to the y-axis, any point on this line has the same x-coordinate as Q. Thus, the x-coordinate of R is $x_2$. Therefore, the coordinates of point R are $(x_2, y_1)$.

Cartesian plane showing points P(x1, y1) and Q(x2, y2). Lines PR parallel to x-axis and QR parallel to y-axis are drawn, forming a right triangle PRQ at R.

Consider the triangle formed by the points P, R, and Q, which is $\triangle PRQ$.

Since the x-axis and y-axis are perpendicular to each other, any line segment parallel to the x-axis is perpendicular to any line segment parallel to the y-axis. Therefore, the angle at R, $\angle PRQ$, is $90^\circ$. This confirms that $\triangle PRQ$ is a right-angled triangle with PQ as its hypotenuse.

Calculating the Lengths of the Sides

Now we calculate the lengths of the two shorter sides, PR and QR, using the coordinates of the points:

Applying the Pythagorean Theorem

According to the Pythagorean theorem, in a right-angled triangle, the square of the length of the hypotenuse is equal to the sum of the squares of the lengths of the other two sides.

In $\triangle PRQ$, we have:

$(PQ)^2 = (PR)^2 + (QR)^2$

... (i)

Substitute the lengths we calculated:

$(d)^2 = (|x_2 - x_1|)^2 + (|y_2 - y_1|)^2$

... (ii)

We know that for any real number $a$, $(|a|)^2 = a^2$. This is because squaring a number always results in a non-negative value, and the absolute value only affects the sign, which is eliminated by squaring.

Applying this property to equation (ii):

$d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2$

... (iii)

To find the distance $d$, we take the square root of both sides of equation (iii). Since distance is a non-negative quantity, we take the positive square root:

$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$

... (iv)

This is the standard form of the distance formula between two points $(x_1, y_1)$ and $(x_2, y_2)$ in a two-dimensional Cartesian plane.

Important Note on Order of Subtraction

Since $(x_2 - x_1)^2 = (x_1 - x_2)^2$ (squaring a negative number gives the same result as squaring its positive counterpart) and similarly $(y_2 - y_1)^2 = (y_1 - y_2)^2$, the order in which you subtract the coordinates does not affect the final distance. For example, the distance between $(1, 2)$ and $(4, 6)$ can be calculated as:

$d = \sqrt{(4 - 1)^2 + (6 - 2)^2} = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5$

or

$d = \sqrt{(1 - 4)^2 + (2 - 6)^2} = \sqrt{(-3)^2 + (-4)^2} = \sqrt{9 + 16} = \sqrt{25} = 5$

The result is the same.

Distance from the Origin

A special case of the distance formula is finding the distance of a point P$(x, y)$ from the origin O$(0, 0)$. Using the distance formula with $(x_1, y_1) = (0, 0)$ and $(x_2, y_2) = (x, y)$, we get:

$d = \sqrt{(x - 0)^2 + (y - 0)^2}$

$d = \sqrt{x^2 + y^2}$

So, the distance of a point $(x, y)$ from the origin is $\sqrt{x^2 + y^2}$.



Calculating Distance Between Two Points

The distance formula is a direct application of the Pythagorean theorem, allowing us to calculate the shortest distance between any two points in a two-dimensional Cartesian coordinate system. Given two points $P(x_1, y_1)$ and $Q(x_2, y_2)$, the distance $d$ between them is given by the formula:

$\mathbf{d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}}$

This formula measures the length of the straight line segment connecting P and Q.

Steps to Calculate Distance:

To calculate the distance between two points $P(x_1, y_1)$ and $Q(x_2, y_2)$ using the distance formula, follow these steps:

  1. Identify Coordinates: Clearly identify the coordinates of the two points. Let the first point be $(x_1, y_1)$ and the second point be $(x_2, y_2)$. The choice of which point is $(x_1, y_1)$ and which is $(x_2, y_2)$ does not affect the final distance, as $(x_2 - x_1)^2 = (x_1 - x_2)^2$ and $(y_2 - y_1)^2 = (y_1 - y_2)^2$.

  2. Find the Difference in x-coordinates: Subtract the x-coordinate of the first point from the x-coordinate of the second point: $(x_2 - x_1)$.

  3. Square the Difference in x-coordinates: Square the result from Step 2: $(x_2 - x_1)^2$.

  4. Find the Difference in y-coordinates: Subtract the y-coordinate of the first point from the y-coordinate of the second point: $(y_2 - y_1)$.

  5. Square the Difference in y-coordinates: Square the result from Step 4: $(y_2 - y_1)^2$.

  6. Sum the Squared Differences: Add the squared differences from Step 3 and Step 5: $(x_2 - x_1)^2 + (y_2 - y_1)^2$.

  7. Take the Square Root: Calculate the positive square root of the sum obtained in Step 6. This final value is the distance $d$ between the two points.

    $d = \sqrt{\text{Sum from Step 6}}$


Example 1. Find the distance between the points A(2, 3) and B(5, 7).

Answer:

Let the coordinates of point A be $(x_1, y_1) = (2, 3)$ and the coordinates of point B be $(x_2, y_2) = (5, 7)$.

Using the distance formula:

$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$

Substitute the given coordinates:

$d = \sqrt{(5 - 2)^2 + (7 - 3)^2}$

Calculate the differences inside the parentheses:

$d = \sqrt{(3)^2 + (4)^2}$

Square the differences:

$d = \sqrt{9 + 16}$

Add the squared values:

$d = \sqrt{25}$

Take the square root:

$d = 5$

The distance between points A(2, 3) and B(5, 7) is $\textbf{5 units}$.


Example 2. Find the distance between the points P(-3, 4) and Q(2, -1).

Answer:

Let the coordinates of point P be $(x_1, y_1) = (-3, 4)$ and the coordinates of point Q be $(x_2, y_2) = (2, -1)$.

Using the distance formula:

$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$

Substitute the given coordinates. Be careful with the signs, especially when subtracting negative numbers:

$d = \sqrt{(2 - (-3))^2 + (-1 - 4)^2}$

Simplify the differences inside the parentheses:

$d = \sqrt{(2 + 3)^2 + (-5)^2}$

$d = \sqrt{(5)^2 + (-5)^2}$

Square the differences. Remember that squaring a negative number results in a positive number:

$d = \sqrt{25 + 25}$

Add the squared values:

$d = \sqrt{50}$

Simplify the square root if possible. We can factor out a perfect square from 50 ($50 = 25 \times 2$):

$d = \sqrt{25 \times 2} = \sqrt{25} \times \sqrt{2} = 5\sqrt{2}$

The distance between points P(-3, 4) and Q(2, -1) is $\mathbf{5\sqrt{2} \text{ units}}$.


Distance from the Origin

A frequently encountered scenario is finding the distance of a point from the origin O(0, 0). We can derive a simplified formula for this specific case using the general distance formula. Consider a point $P(x, y)$ and the origin $O(0, 0)$. Let $(x_1, y_1) = (0, 0)$ and $(x_2, y_2) = (x, y)$.

Using the distance formula:

$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$

Substitute the coordinates of P and O:

$d = \sqrt{(x - 0)^2 + (y - 0)^2}$

$d = \sqrt{x^2 + y^2}$

So, the distance of a point $(x, y)$ from the origin $(0, 0)$ is given by:

$\mathbf{d = \sqrt{x^2 + y^2}}$


Example 3. Find the distance of the point R(-6, 8) from the origin.

Answer:

We need to find the distance between R(-6, 8) and the origin O(0, 0). We can use the simplified formula for the distance from the origin, where $x = -6$ and $y = 8$.

$d = \sqrt{x^2 + y^2}$

Substitute the values of $x$ and $y$:

$d = \sqrt{(-6)^2 + (8)^2}$

Square the coordinates:

$d = \sqrt{36 + 64}$

Add the results:

$d = \sqrt{100}$

Take the square root:

$d = 10$

The distance of point R(-6, 8) from the origin is $\textbf{10 units}$.



Applications of Distance Formula (e.g., verifying geometric properties, collinearity)

The distance formula, derived from the Pythagorean theorem, is a powerful analytical tool in coordinate geometry. It allows us to measure the lengths of segments connecting points, which in turn enables us to verify fundamental geometric properties, classify figures, and solve various problems involving distances between points or sets of points.

Given the distance formula between two points $P(x_1, y_1)$ and $Q(x_2, y_2)$ as $d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$, let's explore its primary applications.

1. Verifying Properties of Geometric Shapes

By calculating the lengths of sides, diagonals, and other segments using the distance formula, we can determine the type of geometric figure formed by a given set of vertices. This method provides a rigorous way to prove properties that might otherwise only be observed visually from a graph.

Properties of Triangles:

Given the vertices of a triangle, say A, B, and C, we calculate the lengths of the three sides AB, BC, and CA using the distance formula. Based on these lengths, we can classify the triangle:

Properties of Quadrilaterals:

Given the vertices of a quadrilateral, say A, B, C, and D, we calculate the lengths of the four sides (AB, BC, CD, DA) and the two diagonals (AC, BD). Based on these lengths, we can classify the quadrilateral:


Example 1. Show that the points A(1, 7), B(4, 2), C(-1, -1), and D(-4, 4) are the vertices of a square.

Answer:

To show that ABCD is a square, we need to verify two properties using the distance formula: that all four sides are equal, and that the two diagonals are equal.

Step 1: Calculate the lengths of the four sides.

  • Length of AB: Using A$(1, 7)$ and B$(4, 2)$

    $AB = \sqrt{(4-1)^2 + (2-7)^2} = \sqrt{(3)^2 + (-5)^2} = \sqrt{9 + 25} = \sqrt{34}$

  • Length of BC: Using B$(4, 2)$ and C$(-1, -1)$

    $BC = \sqrt{(-1-4)^2 + (-1-2)^2} = \sqrt{(-5)^2 + (-3)^2} = \sqrt{25 + 9} = \sqrt{34}$

  • Length of CD: Using C$(-1, -1)$ and D$(-4, 4)$

    $CD = \sqrt{(-4-(-1))^2 + (4-(-1))^2} = \sqrt{(-4+1)^2 + (4+1)^2} = \sqrt{(-3)^2 + (5)^2} = \sqrt{9 + 25} = \sqrt{34}$

  • Length of DA: Using D$(-4, 4)$ and A$(1, 7)$

    $DA = \sqrt{(1-(-4))^2 + (7-4)^2} = \sqrt{(1+4)^2 + (3)^2} = \sqrt{(5)^2 + (3)^2} = \sqrt{25 + 9} = \sqrt{34}$

Since $AB = BC = CD = DA = \sqrt{34}$, all four sides of the quadrilateral are equal. This confirms that ABCD is either a rhombus or a square.

Step 2: Calculate the lengths of the two diagonals.

  • Length of diagonal AC: Using A$(1, 7)$ and C$(-1, -1)$

    $AC = \sqrt{(-1-1)^2 + (-1-7)^2} = \sqrt{(-2)^2 + (-8)^2} = \sqrt{4 + 64} = \sqrt{68}$

  • Length of diagonal BD: Using B$(4, 2)$ and D$(-4, 4)$

    $BD = \sqrt{(-4-4)^2 + (4-2)^2} = \sqrt{(-8)^2 + (2)^2} = \sqrt{64 + 4} = \sqrt{68}$

Since the diagonals $AC$ and $BD$ are equal ($AC = BD = \sqrt{68}$), and we already established that all sides are equal, the quadrilateral ABCD has all sides equal and its diagonals are equal.

Therefore, the points A(1, 7), B(4, 2), C(-1, -1), and D(-4, 4) are the vertices of a square.


2. Checking for Collinearity of Three Points

Three or more points are said to be collinear if they lie on the same straight line. The distance formula provides a method to test for collinearity without using slopes or the concept of the area of a triangle.

To check if three distinct points A, B, and C are collinear using the distance formula, we calculate the distances between all three pairs of points: $d(A, B)$, $d(B, C)$, and $d(A, C)$.

If the points are collinear, then the sum of the lengths of the two shorter segments must be equal to the length of the longest segment. For example, if B lies between A and C on the line, then the distance from A to B plus the distance from B to C must equal the distance from A to C. That is, $AB + BC = AC$.

Condition for Collinearity: Three points A, B, and C are collinear if and only if one of the following three conditions holds true:

In simpler terms, pick the two distances that sum up to the largest distance.


Example 2. Determine if the points P(1, 5), Q(2, 3), and R(3, 1) are collinear.

Answer:

We will calculate the distances between all three pairs of points P, Q, and R using the distance formula.

  • Distance PQ: Using P$(1, 5)$ and Q$(2, 3)$

    $PQ = \sqrt{(2-1)^2 + (3-5)^2} = \sqrt{(1)^2 + (-2)^2} = \sqrt{1 + 4} = \sqrt{5}$

  • Distance QR: Using Q$(2, 3)$ and R$(3, 1)$

    $QR = \sqrt{(3-2)^2 + (1-3)^2} = \sqrt{(1)^2 + (-2)^2} = \sqrt{1 + 4} = \sqrt{5}$

  • Distance PR: Using P$(1, 5)$ and R$(3, 1)$

    $PR = \sqrt{(3-1)^2 + (1-5)^2} = \sqrt{(2)^2 + (-4)^2} = \sqrt{4 + 16} = \sqrt{20}$

    We can simplify $\sqrt{20}$: $\sqrt{20} = \sqrt{4 \times 5} = \sqrt{4} \times \sqrt{5} = 2\sqrt{5}$

    So, $PR = 2\sqrt{5}$.

Now, we check if the sum of any two distances equals the third distance. The three distances are $\sqrt{5}$, $\sqrt{5}$, and $2\sqrt{5}$. Clearly, $2\sqrt{5}$ is the largest distance.

Let's check if the sum of the two smaller distances equals the largest distance:

$PQ + QR = \sqrt{5} + \sqrt{5} = (1+1)\sqrt{5} = 2\sqrt{5}$

... (i)

$PR = 2\sqrt{5}$

... (ii)

From (i) and (ii), we see that $PQ + QR = PR$.

Since the sum of the lengths of two segments ($PQ$ and $QR$) equals the length of the third segment ($PR$), the points P, Q, and R are collinear.

Alternative Method (Using Slope or Area)

While the distance formula method works, checking collinearity using slopes or the area of a triangle is often computationally simpler, especially when the distances are not easily simplified or involve irrational numbers. Three points A, B, C are collinear if:

  • The slope of AB is equal to the slope of BC (provided B is not the same as A or C). Slope of a line segment joining $(x_1, y_1)$ and $(x_2, y_2)$ is $m = \frac{y_2 - y_1}{x_2 - x_1}$.
  • The area of the triangle formed by A, B, and C is zero. The formula for the area of a triangle with vertices $(x_1, y_1)$, $(x_2, y_2)$, and $(x_3, y_3)$ is $\frac{1}{2} |x_1(y_2 - y_3) + x_2(y_3 - y_1) + x_3(y_1 - y_2)|$. If this area is 0, the points are collinear.

3. Finding Points Equidistant from Others

A common application is finding the coordinates of a point that is located at the same distance from two or more given points. This is useful in various geometric constructions and problems.

To find a point P that is equidistant from points A and B, we set the distance $d(P, A)$ equal to the distance $d(P, B)$, i.e., $PA = PB$. Squaring both sides ($PA^2 = PB^2$) often simplifies the calculation by removing the square roots.


Example 3. Find a point on the x-axis which is equidistant from the points A(2, -5) and B(-2, 9).

Answer:

Let the required point on the x-axis be P. Any point on the x-axis has its y-coordinate equal to $0$. So, let the coordinates of P be $(x, 0)$.

We are given that point P is equidistant from point A(2, -5) and point B(-2, 9).

Thus, $PA = PB$.

Squaring both sides to eliminate the square root, we have $PA^2 = PB^2$.

Step 1: Calculate $PA^2$ using the distance formula squared.

Using $P(x, 0)$ and $A(2, -5)$: $(x_1, y_1) = (x, 0)$, $(x_2, y_2) = (2, -5)$

$PA^2 = (2 - x)^2 + (-5 - 0)^2 = (2 - x)^2 + (-5)^2 = (2 - x)^2 + 25$

We can also write $(2-x)^2$ as $(x-2)^2$. So, $PA^2 = (x - 2)^2 + 25$.

Step 2: Calculate $PB^2$ using the distance formula squared.

Using $P(x, 0)$ and $B(-2, 9)$: $(x_1, y_1) = (x, 0)$, $(x_2, y_2) = (-2, 9)$

$PB^2 = (-2 - x)^2 + (9 - 0)^2 = (-2 - x)^2 + (9)^2 = (-2 - x)^2 + 81$

Note that $(-2 - x)^2 = (-(2+x))^2 = (2+x)^2$. So, $PB^2 = (x + 2)^2 + 81$.

Step 3: Set $PA^2 = PB^2$ and solve for $x$.

$(x - 2)^2 + 25 = (x + 2)^2 + 81$

($PA^2 = PB^2$)

Expand the squared terms using $(a-b)^2 = a^2 - 2ab + b^2$ and $(a+b)^2 = a^2 + 2ab + b^2$:

$(x^2 - 4x + 4) + 25 = (x^2 + 4x + 4) + 81$

... (i)

Simplify both sides of equation (i):

$x^2 - 4x + 29 = x^2 + 4x + 85$

... (ii)

Subtract $x^2$ from both sides of equation (ii):

$-4x + 29 = 4x + 85$

... (iii)

Rearrange the terms to collect x terms on one side and constants on the other. Subtract $4x$ from both sides and subtract $29$ from both sides of equation (iii):

$29 - 85 = 4x + 4x$

... (iv)

Simplify equation (iv):

$-56 = 8x$

... (v)

Solve for x by dividing both sides of equation (v) by 8:

$x = \frac{-56}{8}$

... (vi)

$x = -7$

... (vii)

The x-coordinate of the point P is $-7$. Since P is on the x-axis, its y-coordinate is $0$.

Therefore, the coordinates of the point on the x-axis equidistant from A and B are $\textbf{(-7, 0)}$.